const screenshot = require('screenshot-desktop')

const generateScreenshot = async (ssName) => {
  await screenshot.listDisplays().then(async (displays) => {
    // displays: [{ id, name }, { id, name }]
    await screenshot({ filename: ssName, screen: displays[displays.length - 1].id }).then((imgPath) => {
      // imgPath: absolute path to screenshot
      // created in current working directory named ssName
      //console.log(imgPath);
    });
  })
  return ssName;

}
module.exports = generateScreenshot;